home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softdisk Supreme
/
Softdisk Supreme.iso
/
pc
/
DSK Files
/
0-49
/
SD001b.dsk
/
USING.bas
< prev
Wrap
BASIC Source File
|
2003-06-12
|
2KB
|
43 lines
1 REM USING
2 REM IMITATES PRINT USING
3 REM SUBROUTINE STARTS AT 1000
4 REM PASS IT 4 PARAMETERS
5 REM ND = MAX NUMBER OF DIGITS
6 REM DP = NUMBER OF DIGITS TO
7 REM THE RIGHT OF THE
8 REM DECIMAL POINT
9 REM CM = 1 IF YOU WANT
10 REM COMMAS
11 REM = 0 IF YOU DON'T
12 REM WANT COMMAS
13 REM NB = NUMBER TO BE EDITED
14 REM
15 REM EDITED NUMBER IS RETURNED
16 REM IN THE STRING NB$
17 REM ------------------------
18 HOME : VTAB 5
20 INPUT "MAXIMUN NUMBER OF DIGITS ";ND
30 INPUT "NUMBER OF DECIMAL PLACES ";DP
40 INPUT " WANT COMMAS (Y OR N) ";R$
50 CM = 0: IF R$ = "Y" THEN CM = 1
55 PRINT "---------------------------"
60 INPUT "NUMBER TO BE EDITED ";NB
65 PRINT NB
70 GOSUB 1000: INVERSE : PRINT NB$: NORMAL : GOTO 55
999 REM ========================
1000 REM USING SUBROUTINE
1001 SP$ = " ":ZS$ = "00000000":AS$ = "********":Z = 0:W = 1
1002 NB$ = STR$( INT((NB +(5/10 ^(DP +W))) *10 ^DP))
1005 IF LEFT$(NB$,W) = "-" THEN NB$ = RIGHT$(NB$, LEN(NB$) -W)
1010 IF LEN(NB$) >ND THEN NB$ = LEFT$(AS$,ND)
1015 NN = DP +W - LEN(NB$): IF NN >Z THEN NB$ = LEFT$(ZS$,NN) +NB$
1020 NN = ND - LEN(NB$): IF NN >Z THEN NB$ = LEFT$(SP$,NN) +NB$
1025 IF DP >Z THEN NB$ = LEFT$(NB$,ND -DP) +"." + RIGHT$(NB$,DP)
1030 IF CM = Z GOTO 1055
1035 NN = ND: IF DP < >Z THEN NN = ND -DP
1040 NN = NN -3: IF NN <W GOTO 1055
1045 SN$ = ",": IF MID$ (NB$,NN,W) = " " THEN SN$ = " "
1050 NB$ = LEFT$(NB$,NN) +SN$ + RIGHT$(NB$, LEN(NB$) -NN): GOTO 1040
1055 SN$ = " ": IF NB <Z THEN SN$ = "-"
1060 NB$ = NB$ +SN$: RETURN
1070 REM =======================